package cn.htsyb.synergy.tester.config;

public class DriverConfig extends InitConfig {
    private static String browserType;
    private static Boolean compelBool;

    private static Integer explicitWaitTimeOut;
    private static Integer implicitlyWaitTimeOut;
    private static Integer pageloadTimeOut;
    private static Integer setScriptTimeout;

    public static String getBrowserType() {
        browserType = null == browserType ? synertestConfig.getString("webdriver[@browser]").trim() : browserType;
        return browserType;
    }

    public static Boolean getCompelBool() {
        compelBool = null == compelBool ? synertestConfig.getBoolean("webdriver[@compel]") : compelBool;
        return compelBool;
    }

    public static String getDriverPathOfWebDriver(String browserType) {
        return synertestConfig.getString("webdriver." + browserType + ".driverPath").trim();
    }

    public static String getBinaryPathOfWebDriver(String browserType) {
        return synertestConfig.getString("webdriver." + browserType + ".binaryPath").trim();
    }

    public static int getExplicitWaitOutTime() {
        explicitWaitTimeOut = explicitWaitTimeOut == null
                ? synertestConfig.getInt("webdriver.configuration.explicitWaitTimeOut") : explicitWaitTimeOut;
        return explicitWaitTimeOut;
    }

    public static int getImplicitlyWaitTimeOut() {
        explicitWaitTimeOut = implicitlyWaitTimeOut == null
                ? synertestConfig.getInt("webdriver.configuration.implicitlyWaitTimeOut") : implicitlyWaitTimeOut;
        return implicitlyWaitTimeOut;
    }

    public static int getPageloadTimeOut() {
        pageloadTimeOut = pageloadTimeOut == null ? synertestConfig.getInt("webdriver.configuration.pageloadTimeOut")
                : pageloadTimeOut;
        return pageloadTimeOut;
    }

    public static int getSetScriptTimeout() {
        setScriptTimeout = setScriptTimeout == null ? synertestConfig.getInt("webdriver.configuration.setScriptTimeout")
                : setScriptTimeout;
        return setScriptTimeout;
    }

}
